﻿// Decompiled with JetBrains decompiler
// Type: Bannerlord.ModuleManager.DependentModuleMetadata
// Assembly: MCMv5, Version=5.10.2.0, Culture=neutral, PublicKeyToken=null
// MVID: 7AB326B9-B2B4-41C2-9177-68E944071101
// Assembly location: D:\steam\steamapps\workshop\content\261550\2859238197\bin\Win64_Shipping_Client\MCMv5.dll

using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;

#nullable enable
namespace Bannerlord.ModuleManager
{
  internal record DependentModuleMetadata()
  {
    public string Id { get; set; } = string.Empty;

    public LoadType LoadType { get; set; }

    public bool IsOptional { get; set; }

    public bool IsIncompatible { get; set; }

    public ApplicationVersion Version { get; set; } = ApplicationVersion.Empty;

    public ApplicationVersionRange VersionRange { get; set; } = ApplicationVersionRange.Empty;

    public DependentModuleMetadata(
      string id,
      LoadType loadType,
      bool isOptional,
      bool isIncompatible,
      ApplicationVersion version,
      ApplicationVersionRange versionRange)
    {
      this.Id = id;
      this.LoadType = loadType;
      this.IsOptional = isOptional;
      this.IsIncompatible = isIncompatible;
      this.Version = version;
      this.VersionRange = versionRange;
    }

    public static string GetLoadType(LoadType loadType)
    {
      if (true)
        ;
      string loadType1;
      switch (loadType)
      {
        case LoadType.None:
          loadType1 = "";
          break;
        case LoadType.LoadAfterThis:
          loadType1 = "Before       ";
          break;
        case LoadType.LoadBeforeThis:
          loadType1 = "After        ";
          break;
        default:
          loadType1 = "ERROR        ";
          break;
      }
      if (true)
        ;
      return loadType1;
    }

    public static string GetVersion(ApplicationVersion? av)
    {
      return (object) av == null || !av.IsSameWithChangeSet(ApplicationVersion.Empty) ? string.Format(" {0}", (object) av) : "";
    }

    public static string GetVersionRange(ApplicationVersionRange? avr)
    {
      return !(avr == ApplicationVersionRange.Empty) ? string.Format(" {0}", (object) avr) : "";
    }

    public static string GetOptional(bool isOptional) => !isOptional ? "" : " Optional";

    public static string GetIncompatible(bool isOptional) => !isOptional ? "" : "Incompatible ";

    public override string ToString()
    {
      return DependentModuleMetadata.GetLoadType(this.LoadType) + DependentModuleMetadata.GetIncompatible(this.IsIncompatible) + this.Id + DependentModuleMetadata.GetVersion(this.Version) + DependentModuleMetadata.GetVersionRange(this.VersionRange) + DependentModuleMetadata.GetOptional(this.IsOptional);
    }

    [CompilerGenerated]
    protected virtual bool PrintMembers(StringBuilder builder)
    {
      RuntimeHelpers.EnsureSufficientExecutionStack();
      builder.Append("Id = ");
      builder.Append((object) this.Id);
      builder.Append(", LoadType = ");
      builder.Append(this.LoadType.ToString());
      builder.Append(", IsOptional = ");
      builder.Append(this.IsOptional.ToString());
      builder.Append(", IsIncompatible = ");
      builder.Append(this.IsIncompatible.ToString());
      builder.Append(", Version = ");
      builder.Append((object) this.Version);
      builder.Append(", VersionRange = ");
      builder.Append((object) this.VersionRange);
      return true;
    }

    [CompilerGenerated]
    public override int GetHashCode()
    {
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      return (((((EqualityComparer<Type>.Default.GetHashCode(this.EqualityContract) * -1521134295 + EqualityComparer<string>.Default.GetHashCode(this.\u003CId\u003Ek__BackingField)) * -1521134295 + EqualityComparer<LoadType>.Default.GetHashCode(this.\u003CLoadType\u003Ek__BackingField)) * -1521134295 + EqualityComparer<bool>.Default.GetHashCode(this.\u003CIsOptional\u003Ek__BackingField)) * -1521134295 + EqualityComparer<bool>.Default.GetHashCode(this.\u003CIsIncompatible\u003Ek__BackingField)) * -1521134295 + EqualityComparer<ApplicationVersion>.Default.GetHashCode(this.\u003CVersion\u003Ek__BackingField)) * -1521134295 + EqualityComparer<ApplicationVersionRange>.Default.GetHashCode(this.\u003CVersionRange\u003Ek__BackingField);
    }

    [CompilerGenerated]
    public virtual bool Equals(DependentModuleMetadata? other)
    {
      if ((object) this == (object) other)
        return true;
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      return (object) other != null && this.EqualityContract == other.EqualityContract && EqualityComparer<string>.Default.Equals(this.\u003CId\u003Ek__BackingField, other.\u003CId\u003Ek__BackingField) && EqualityComparer<LoadType>.Default.Equals(this.\u003CLoadType\u003Ek__BackingField, other.\u003CLoadType\u003Ek__BackingField) && EqualityComparer<bool>.Default.Equals(this.\u003CIsOptional\u003Ek__BackingField, other.\u003CIsOptional\u003Ek__BackingField) && EqualityComparer<bool>.Default.Equals(this.\u003CIsIncompatible\u003Ek__BackingField, other.\u003CIsIncompatible\u003Ek__BackingField) && EqualityComparer<ApplicationVersion>.Default.Equals(this.\u003CVersion\u003Ek__BackingField, other.\u003CVersion\u003Ek__BackingField) && EqualityComparer<ApplicationVersionRange>.Default.Equals(this.\u003CVersionRange\u003Ek__BackingField, other.\u003CVersionRange\u003Ek__BackingField);
    }

    [CompilerGenerated]
    protected DependentModuleMetadata(DependentModuleMetadata original)
    {
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      this.\u003CId\u003Ek__BackingField = original.\u003CId\u003Ek__BackingField;
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      this.\u003CLoadType\u003Ek__BackingField = original.\u003CLoadType\u003Ek__BackingField;
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      this.\u003CIsOptional\u003Ek__BackingField = original.\u003CIsOptional\u003Ek__BackingField;
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      this.\u003CIsIncompatible\u003Ek__BackingField = original.\u003CIsIncompatible\u003Ek__BackingField;
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      this.\u003CVersion\u003Ek__BackingField = original.\u003CVersion\u003Ek__BackingField;
      // ISSUE: reference to a compiler-generated field
      // ISSUE: reference to a compiler-generated field
      this.\u003CVersionRange\u003Ek__BackingField = original.\u003CVersionRange\u003Ek__BackingField;
    }
  }
}
